package cn.iocoder.yudao.module.bpm.dal.mysql.modeltemplate;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.bpm.controller.admin.modeltemplate.vo.ModelTemplatePageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.modeltemplate.ModelTemplateDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 流程模板 Mapper
 *
 * @author 数创万维
 */
@Mapper
public interface ModelTemplateMapper extends BaseMapperX<ModelTemplateDO> {

    default PageResult<ModelTemplateDO> selectPage(ModelTemplatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ModelTemplateDO>()
                .eqIfPresent(ModelTemplateDO::getModelKey, reqVO.getModelKey())
                .likeIfPresent(ModelTemplateDO::getName, reqVO.getName())
                .eqIfPresent(ModelTemplateDO::getCategory, reqVO.getCategory())
                .betweenIfPresent(ModelTemplateDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ModelTemplateDO::getId));
    }

}